#ifndef __STATIC_LAYER_H__
#define __STATIC_LAYER_H__

#include "../common/costmap_base.h"

namespace costmap_2d{

class StaticLayer{
    public:
        StaticLayer(boost::shared_ptr<Costmap> realtime_costmap_ptr, tf2_ros::Buffer* tf_buffer);
        ~StaticLayer() = default;

        // 设置地图原始数据
        void setMap(boost::shared_ptr<Costmap> origin_costmap_ptr);
        // 更新代价地图
        void updateCostmap(bool is_local);
        // 清空代价地图
        void clearCostmap();

        // 返回障碍物数据
        std::unordered_map<int, GridCell> getObstacleCells(){
            return obstacleCells_;
        }
        // 是否设置地图数据
        bool hasSetMap(){
            return !(originCostmapPtr_ == nullptr);
        }

    private:
        tf2_ros::Buffer* const tfBuffer_;
        boost::shared_ptr<Costmap> originCostmapPtr_;       //全局静态地图
        boost::shared_ptr<Costmap> realtimeCostmapPtr_;     //实时代价地图 全局或局部
        std::unordered_map<int, GridCell> obstacleCells_;   //障碍物数据
};

}; //costmap_2d

#endif